﻿using EMall.Domain;

namespace EMall.OrderService.Orders
{
    public class OrderItem : Entity<int>
    {
        public int OrderId { get; private set; }
        public int ProductId { get; private set; }
        public string ProductName { get; private set; }
        public decimal UnitPrice { get; private set; }
        public int Quantity { get; private set; }
        public OrderItem(int orderId, int productId, string productName, decimal unitPrice, int quantity)
        {
            ProductId = productId;
            ProductName = productName;
            UnitPrice = unitPrice;
            Quantity = quantity;
        }
        public void AddQuantity(int quantity)
        {
            if (quantity > 0)
            {
                Quantity += quantity;
            }
        }
    }
}
